home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / usr / lib / os-probes / mounted / 40lsb < prev    next >
Text File  |  2008-08-25  |  887b  |  49 lines

  1. #!/bin/sh
  2. # Test for LSB systems.
  3. set -e
  4.  
  5. . /usr/share/os-prober/common.sh
  6.  
  7. partition="$1"
  8. dir="$2"
  9. type="$3"
  10.  
  11. lsb_field () {
  12.     file="$1"
  13.     field="$2"
  14.     grep ^"$field" "$file" | cut -d = -f 2 | sed 's/^"//' | sed 's/"$//' | sed 's/:/ /g'
  15. }
  16.  
  17. file="$dir/etc/lsb-release"
  18. if [ ! -e "$file" ]; then
  19.     exit 1
  20. fi
  21.  
  22. release=$(lsb_field "$file" DISTRIB_RELEASE)
  23. if [ -z "$release" ]; then
  24.     release=$(lsb_field "$file" DISTRIB_CODENAME)
  25. fi
  26. description=$(lsb_field "$file" DISTRIB_DESCRIPTION)
  27. if [ -z "$description" ]; then
  28.     description=$(lsb_field "$file" DISTRIB_CODENAME)
  29. fi
  30.  
  31. if [ -n "$description" ]; then
  32.     if [ -n "$release" ]; then
  33.         long="$description ($release)"
  34.     else
  35.         long="$description"
  36.     fi
  37. else
  38.     exit 1
  39. fi
  40.  
  41. short=$(lsb_field "$file" DISTRIB_ID | sed 's/ //g')
  42. if [ -z "$short" ]; then
  43.     short="UnknownLSB"
  44. fi
  45.  
  46. label=$(count_next_label $short)
  47. result "$partition:$long:$label:linux"
  48. exit 0
  49.